module CanCamel::Filters
  class AtDay < Base
    def catch_args
      %i(days wdays)
    end

    def validate!
      validates presence_of: {
        fields: %i(days wdays),
        any: true,
      }
    end

    def filter(days: nil, wdays: nil)
      return if days && !days.include?(Time.now.day)
      return if wdays && !wdays.include?(Time.now.wday)
      {}
    end
  end
end
